//
//  ZDoctorVCHeadView.m
//  DoctorFAQs
//
//  Created by zjq on 17/2/20.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "ZDoctorVCHeadView.h"
#import "ZLabelTools.h"
@interface ZDoctorVCHeadView () {
    UIImageView * _backgroundImgaeView;
    UIImageView * _faviconImageView; // 头像
    UILabel * _nameLabel;
    UILabel * _ksLabel;
    UILabel * _levelLabel;
    UIImageView * _crossImageView; // 十字
    UILabel * _hospitalLabel;
    UILabel * _doctorTheIDLabel;
    UILabel * _gradesLabel;// 评分
    UILabel * _gradesnumberLabel;
    UILabel * _answerlabel;//解答
    UILabel * _answerNumberLabel;
    UILabel * _essayLabel;// 文章
    UILabel * _essayNumberLabel;
    UILabel * _videoLabel;// 视频
    UILabel * _videoNumberLaber;
}
@end
@implementation ZDoctorVCHeadView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initlizeInterface];
    }
    return self;
}
- (void)setModel:(ZDctorcNModel *)model {
    _model = model;
    _nameLabel.text = model.name;
    _ksLabel.text = model.office;
    _levelLabel.text = model.job_title;
    _hospitalLabel.text = model.hospital;
    _gradesnumberLabel.text = model.score;
    _answerNumberLabel.text = model.jieda;
    _essayNumberLabel.text = model.article;
    _videoNumberLaber.text = model.video;
    _doctorTheIDLabel.text = model.number;
    [_faviconImageView  sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",IconURL,model.pic]] placeholderImage:[UIImage imageNamed:@"about-us"]];
}
- (void)initlizeInterface {
    [self makeAllSubView];
    [self addAllSubView];
    [self makeAllSubViewManosy];
}
- (void)makeAllSubView {
    _backgroundImgaeView = [[UIImageView alloc] init];
    _faviconImageView = [[UIImageView alloc] init];
    _faviconImageView.layer.cornerRadius = 40*xsIZE;
    _faviconImageView.layer.masksToBounds = YES;
    _nameLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_nameLabel Textcolor:[UIColor whiteColor] backColor:[UIColor clearColor] Fontsize:18 context:@"" isCenter:NO];
    _ksLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_ksLabel Textcolor:[UIColor whiteColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:YES];
    _levelLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_levelLabel Textcolor:[UIColor whiteColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:NO];
    _crossImageView = [[UIImageView alloc] init];
    _crossImageView.image = [UIImage imageNamed:@""];
    _hospitalLabel = [[UILabel alloc]init];
    [ZLabelTools setThelabel:_hospitalLabel Textcolor:[UIColor whiteColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:NO];
    _doctorTheIDLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_doctorTheIDLabel Textcolor:[UIColor whiteColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:NO];
    _gradesnumberLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_gradesnumberLabel Textcolor:[UIColor blackColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:YES];
    _gradesLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_gradesLabel Textcolor:KHGaryColor backColor:[UIColor clearColor] Fontsize:13 context:@"评分" isCenter:YES];
    _answerNumberLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_answerNumberLabel Textcolor:[UIColor blackColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:YES];
    _answerlabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_answerlabel Textcolor:KHGaryColor backColor:[UIColor clearColor] Fontsize:13 context:@"解答" isCenter:YES];
    _essayNumberLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_essayNumberLabel Textcolor:[UIColor blackColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:YES];
    _essayLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_essayLabel Textcolor:KHGaryColor backColor:[UIColor clearColor] Fontsize:13 context:@"文章" isCenter:YES];
    _videoNumberLaber = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_videoNumberLaber Textcolor:[UIColor blackColor] backColor:[UIColor clearColor] Fontsize:15 context:@"" isCenter:YES];
    _videoLabel = [[UILabel alloc] init];
    [ZLabelTools setThelabel:_videoLabel Textcolor:KHGaryColor backColor:[UIColor clearColor] Fontsize:13 context:@"视频" isCenter:YES];
    _wenzhangBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _videoBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    
 }
-(void)addAllSubView {
    [self addSubview:_backgroundImgaeView];
    [self addSubview:_faviconImageView];
    [self addSubview:_nameLabel];
    [self addSubview:_ksLabel];
    [self addSubview:_levelLabel];
    [self addSubview:_crossImageView];
    [self addSubview:_hospitalLabel];
    [self addSubview:_doctorTheIDLabel];
    [self addSubview:_gradesnumberLabel];
    [self addSubview:_gradesLabel];
    [self addSubview:_answerNumberLabel];
    [self addSubview:_answerlabel];
    [self addSubview:_essayNumberLabel];
    [self addSubview:_essayLabel];
    [self addSubview:_videoNumberLaber];
    [self addSubview:_videoLabel];
    [self addSubview:_wenzhangBtn];
    [self addSubview:_videoBtn];
}
-(void)makeAllSubViewManosy {
    [_backgroundImgaeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.width.top.equalTo(self);
        make.height.offset(170*ysIZE);
    }];
    [_faviconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(13*xsIZE);
        make.width.offset(80*xsIZE);
        make.height.equalTo(_faviconImageView.mas_width);
        make.top.equalTo(self).offset(56*ysIZE);
    }];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_faviconImageView.mas_right).offset(10*xsIZE);
        make.height.offset(18*ysIZE);
        make.width.offset(65*xsIZE);
        make.top.equalTo(self).offset(64*ysIZE);
    }];
    [_ksLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nameLabel.mas_right);
        make.height.offset(15*ysIZE);
        make.bottom.equalTo(_nameLabel);
        make.width.offset(80*xsIZE);
    }];
    [_levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_ksLabel.mas_right);
        make.height.offset(15*ysIZE);
        make.width.offset(80*xsIZE);
        make.bottom.equalTo(_ksLabel);
    }];
    [_crossImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nameLabel);
        make.height.width.offset(15*xsIZE);
        make.top.equalTo(_nameLabel.mas_bottom).offset(14*ysIZE);
    }];
    [_hospitalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_crossImageView.mas_right);
        make.height.offset(15*ysIZE);
        make.width.offset(120*xsIZE);
        make.top.equalTo(_crossImageView);
    }];
    [_doctorTheIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nameLabel);
        make.top.equalTo(_hospitalLabel.mas_bottom).offset(10*ysIZE);
        make.height.offset(12*xsIZE);
        make.width.offset(200*xsIZE);
    }];
    [_gradesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(25*xsIZE);
        make.bottom.equalTo(self).offset(-11*ysIZE);
        make.height.offset(15*ysIZE);
        make.width.offset(50*xsIZE);
    }];
    [_gradesnumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_gradesLabel);
        make.top.equalTo(_backgroundImgaeView.mas_bottom).offset(10.5*ysIZE);
        make.height.offset(15*ysIZE);
        make.width.offset(50*xsIZE);
    }];
    [_answerlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_gradesLabel.mas_right).offset(22.5*xsIZE);
        make.height.width.equalTo(_gradesLabel);
        make.top.equalTo(_gradesLabel);
    }];
    [_answerNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_answerlabel);
        make.width.height.top.equalTo(_gradesnumberLabel);
    }];
    [_essayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.width.height.equalTo(_answerlabel);
        make.left.equalTo(_answerlabel.mas_right).offset(22.5*xsIZE);
    }];
    [_essayNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.width.height.equalTo(_answerNumberLabel);
        make.centerX.equalTo(_essayLabel);
    }];
    [_videoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.width.height.equalTo(_essayLabel);
        make.right.equalTo(self).offset(-25*xsIZE);
    }];
    [_videoNumberLaber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_videoLabel);
        make.top.width.height.equalTo(_essayNumberLabel);
    }];
    [_wenzhangBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_essayLabel);
        make.width.equalTo(_essayLabel);
        make.height.offset(40*ysIZE);
        make.centerY.equalTo(_essayLabel.mas_top);
    }];
    [_videoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_videoLabel);
        make.width.equalTo(_videoLabel);
        make.height.offset(40*ysIZE);
        make.centerY.equalTo(_videoLabel.mas_top);
    }];
}
@end
